<?php

class FilesController extends AppController {
	var $name = 'Files';
	//var $components = array('RequestHandler');
	var $helpers = array('Html', 'Form' );
	
	function admin_index() {
		$this->File->recursive = 0;
		$this->set('files', $this->paginate());
	}
	
	function admin_add() {
		if (!empty($this->data)) {
			$this->cleanUpFields();
			$this->File->create();
			if ($this->File->save($this->data)) {
				$this->Session->setFlash('The File has been saved');
				$this->redirect(array('action'=>'admin_index'), null, true);
			} else {
				$this->Session->setFlash('The File could not be saved. Please, try again.');
			}
		}
	}
	
	
}

?>
